<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistributionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('distribution', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('buy_uid')->comment('购买人 订单分销效益生成者')->default(0);
            $table->integer('beneficiary_uid')->comment('受益人id')->default(0);
            $table->string('order_sn')->comment('订单号')->default('');
            $table->string('order_money')->comment('订单金额')->default('');
            $table->string('total_money')->comment('受益金额')->default('');
            $table->string('rate')->comment('分成比例')->default('');
            $table->tinyInteger('level')->comment('分销等级')->default(0);
            $table->tinyInteger('status')->comment('结算状态 0 未结算 1 已结算')->default(0);
            $table->integer('created_at')->comment('记录时间')->default(0);
            $table->integer('updated_at')->comment('修改时间')->default(0);

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('distribution');
    }
}
